#ifndef PROJECTOPENER_H
#define PROJECTOPENER_H

#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <QVector>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QTextStream>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QVariant>
#include <QFileInfo>
#include <QDateTime>
#include <string>
#include <iostream>

using namespace std;

class ProjectOpener
{
public:
    ProjectOpener();
    ~ProjectOpener();
    void addFile(const QString &fileName);
    QStringList getPDN(QString &family);    // Get PDN by family
    QStringList getTime(QString &family, QString &pdn);
    QStringList getFamily() {return families;}                // Get distinct family
    QString getDir() {return dir;}
    QString getStartTime() {return start;}
    QString getProjInfo() {return projectHeader;}
    QVector<QString> getFiles() {return files;}
    bool isProjOpened() { return projOpened;}
private:

    void fileProcess(QFile &file);          // Process input sas file
    void openDB();

    // Image files
    QVector<QString> files;					// List of image files
    QString dir;							// Location of image file
    QString projectHeader;					// Project header information
    int pdn;                                // Number of pdn in experiment
    int family;                             // Number of family
    QStringList pdns;						// List of PDN
    QStringList families;					// List of families
    QStringList pdnByFamily;					
    QStringList timeList;
    QSqlDatabase db;
    QString start;							// Start time of water imbibition
    bool projOpened;                        // Indicates a project has been opened
};

#endif // PROJECTOPENER_H
